<div class="modal fade bs-example-modal-lg" tabindex="-1" aria-labelledby="refund_dialog_title"
     id="refund-detail-modal" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <a href="javascript:void(0);" title="关闭" class="close" data-dismiss="modal">×</a>
                <h4 class="modal-title">
                    退款信息
                </h4>
            </div>
            <div class="modal-body">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-horizontal" role="form" id="refund_form"
                              action="javascript:void(0);" method="post">
                            <fieldset>
                                <legend>历史退款信息</legend>
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        {@if data.buyer2uspayRefundList && data.buyer2uspayRefundList.length > 0}
                                        {@each data.buyer2uspayRefundList as buyer2uspayRefund}
                                        <table data-toggle="table" width="100%" style="margin-top: 10px;"
                                               cellpadding="0" cellspacing="1" border="1">
                                            <thead>
                                            <th width="20%" style="text-align: center">商品名称</th>
                                            <th width="15%" style="text-align: center">规格</th>
                                            <th width="10%" style="text-align: center">数量</th>
                                            <th width="10%" style="text-align: center">单价</th>
                                            <th width="15%" style="text-align: center">总价</th>
                                            <th width="15%" style="text-align: center">退货数量</th>
                                            <th width="15%" style="text-align: center">退款金额(元)</th>
                                            </thead>
                                            <tbody>
                                            {@each buyer2uspayRefund.refundItemList as order}
                                            <tr>
                                                <td height="30" align="center">${order.itemName|empty}</td>
                                                <td align="center">${order.itemProperty|empty} / ${order.unit|empty}
                                                </td>
                                                <td align="center">${order.itemCount|empty}</td>
                                                <td align="center">${(order.itemPrice/100).toFixed(2)}元</td>
                                                <td align="center">
                                                    ${(order.itemPrice*order.itemCount/100).toFixed(2)|empty}元
                                                </td>
                                                <td align="center">${order.refundItemCount}</td>
                                                <td align="center">${order.refundFeeX100/100}</td>
                                            </tr>
                                            {@/each}
                                            </tbody>
                                            <tfoot>
                                            <tr>
                                                <td align="right" height="50" colspan="7" valign="bottom"
                                                    style="padding-right: 10px;">
                                                    <b>退款原因</b>:${buyer2uspayRefund.refundReasonCode|checkRefundReasonCode}
                                                    <b style="padding-left: 10px;">订单总价</b>:<span style="color: red">${(data.bizOrderDO.totalPrice/100).toFixed(2)}</span>元
                                                    <b style="padding-left: 10px;">配送费退款</b>:<span style="color: red">${buyer2uspayRefund.psfRefund/100}</span>元
                                                    <b style="padding-left: 10px;">实际退款</b>:<span style="color: red">${buyer2uspayRefund.refundFeeStr}</span>元
                                                    <b style="padding-left: 10px;">退款时间</b>:${buyer2uspayRefund.refundStartDatetime|formatDate}
                                                </td>
                                            </tr>
                                            </tfoot>
                                        </table>
                                        {@/each}
                                        {@else}
                                        无历史退款记录
                                        {@/if}
                                    </div>
                                </div>
                            </fieldset>
                            <fieldset>
                                <legend>当前退款</legend>
                                <div class="form-group">
                                    <label for="refundReasonCode" class="col-sm-2 control-label">退款原因</label>

                                    <div class="col-sm-10">
                                        <select class="form-control" id="refundReasonCode" name="refundReasonCode">
                                            {@each data.refundReason as refundReason,index}
                                            <option value="${index}">${refundReason}</option>
                                            {@/each}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        <table data-toggle="table" width="100%">
                                            <thead>
                                            <th width="20%" style="text-align: center">商品名称</th>
                                            <th width="15%" style="text-align: center">规格</th>
                                            <th width="10%" style="text-align: center">数量</th>
                                            <th width="10%" style="text-align: center">单价</th>
                                            <th width="15%" style="text-align: center">总价</th>
                                            <th width="15%" style="text-align: center">可退数量</th>
                                            <th width="15%" style="text-align: center">可退金额(元)</th>
                                            </thead>
                                            <tbody>
                                            {@each data.bizOrderDO.subOrders as subOrder}
                                            <tr>
                                                <td height="30" align="center">${subOrder.itemName|empty}</td>
                                                <td align="center">${subOrder.property|empty} / ${subOrder.unit|empty}
                                                </td>
                                                <td align="center">${subOrder.buyAmount|empty}</td>
                                                <td align="center">${(subOrder.itemPrice/100).toFixed(2)}元</td>
                                                <td align="center">
                                                    ${(subOrder.totalPrice/100).toFixed(2)|empty}元
                                                </td>
                                                <td align="center">
                                                    <div class="form-group">
                                                        <input id="items_${subOrder.bizOrderId}"
                                                               name="items_${subOrder.bizOrderId}"
                                                               data-temId="${subOrder.bizOrderId}"
                                                               class="form-control"
                                                               placeholder="最多${subOrder.refundAmount}份"
                                                               max="${subOrder.refundAmount}"
                                                               data-bv-lessthan-inclusive="true"
                                                               data-bv-lessthan-message="最多可退数量为${subOrder.refundAmount}份"/>
                                                    </div>
                                                </td>
                                                <td align="center">
                                                    <div class="form-group">
                                                        <input id="fee_${subOrder.bizOrderId}" name="fee_${subOrder.bizOrderId}"
                                                               data-temId="${subOrder.bizOrderId}"
                                                               class="form-control"
                                                               placeholder="最多${subOrder.maxRefundFee/100}元"
                                                               max="${subOrder.maxRefundFee/100}"
                                                               data-bv-lessthan-inclusive="true"
                                                               data-bv-lessthan-message="最多可退金额为${subOrder.maxRefundFee/100}元"/>
                                                    </div>

                                                </td>
                                            </tr>
                                            {@/each}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                {@if data.bizOrderDO.maxRefundPsf > 0}
                                <div class="form-group" id="refund_psf_fee_div">
                                    <div class="col-sm-12 control-label"><b>配送费</b>:
                                        <input type="text" id="psf_fee" name="psf_fee" placeholder="最多为${data.bizOrderDO.maxRefundPsf/100}元"
                                               max="${data.bizOrderDO.maxRefundPsf/100}"
                                               data-bv-lessthan-inclusive="true"
                                               data-bv-lessthan-message="最多可退金额${data.bizOrderDO.maxRefundPsf/100}元"
                                               style="width:100px;">元
                                    </div>
                                </div>
                                {@/if}
                            </fieldset>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" id="refund_btn" class="btn btn-primary">退 款</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
            </div>
        </div>

    </div>
</div>

